﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="ReportPropertyList.aspx.cs" Inherits="CARMS.AdminTemplate.ReportPropertyList" %>

<%@ Import Namespace="CARMSBusiness.InterFace" %>
<%@ Import Namespace="CARMSBusiness" %>
<%@ Register Src="~/Controls/GridPager.ascx" TagName="GridPager" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table border="0" cellpadding="5" cellspacing="0" width="100%">
        <tr>
            <td>
                <asp:Button ID="btnCreate" Text="Create New" runat="server" OnClick="btnCreate_Click"
                    SkinID="Button120"></asp:Button>
            </td>
        </tr>
        <tr>
            <td>
                <fieldset>
                    <legend>Search Condition</legend>
                    <asp:Panel ID="Panel1" runat="server" DefaultButton="btnSearch">
                        <table border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <vs:FormPanel ID="FormPanel1" runat="server" CaptionAlign="NotSet" RepeatColumns="2">
                                        <Items>
                                            <vs:FormItem HeaderText="Property Name">
                                                <ContentTemplate>
                                                    <asp:TextBox ID="txtPropertyName" MaxLength="125" runat="server"></asp:TextBox>
                                                </ContentTemplate>
                                            </vs:FormItem>
                                        </Items>
                                    </vs:FormPanel>
                                </td>
                                <td valign="bottom" style="padding-left: 10px">
                                    <asp:Button ID="btnSearch" Text="Search" runat="server" OnClick="btnSearch_Click">
                                    </asp:Button>
                                    <asp:Button ID="btnRefresh" runat="server" Text="Search" OnClick="btnRefresh_Click"
                                        CausesValidation="false" Style="display: none;" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </fieldset>
            </td>
        </tr>
        <tr>
            <td>
                <fieldset>
                    <legend>Property List</legend>
                    <div style="padding-top: 15px">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <vs:GridView ID="gridPropertyList" runat="server" AutoGenerateColumns="False" DataKeyNames="PropertyID"
                                    AllowSorting="true" OnRowDataBound="gridPropertyList_RowDataBound" OnRowCommand="gridPropertyList_OnRowCommand"
                                    ItemStyle-Width="100px"  OnRowCancelingEdit="gridList_OnRowCancelingEdit"
                                OnRowUpdating="gridList_OnRowUpdating" OnRowEditing="gridList_OnRowEditing" >
                                    <Columns>
                                        <vs:TemplateField HeaderText="Edit" ItemStyle-Width="40px">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="btnEdit" Style="margin-left: 5px" ToolTip="Edit" runat="server"
                                                    SkinID="Modify" ImageAlign="AbsMiddle" CausesValidation="false" CommandName="EditProperty"
                                                    CommandArgument='<%#Eval("PropertyID") %>' />
                                            </ItemTemplate>
                                        </vs:TemplateField>
                                        <vs:TemplateField HeaderText="Property" SortExpression="PropertyName" ItemStyle-Width="100px">
                                            <ItemTemplate>
                                                <div class="divHidden" style="width: 120px" title='<%# Eval("PropertyName")%>'>
                                                    <%#  Eval("PropertyName")%>
                                                </div>
                                            </ItemTemplate>
                                        </vs:TemplateField>
                                        <vs:TemplateField HeaderText="Property Type" SortExpression="PropertyType" ItemStyle-Width="100px">
                                            <ItemTemplate>
                                                <div class="divHidden" style="width: 120px" title='<%# GetDataName((int)Eval("PropertyType"))%>'>
                                                    <%# GetDataName((int)Eval("PropertyType"))%>
                                                </div>
                                            </ItemTemplate>
                                        </vs:TemplateField>
                                        <vs:TemplateField HeaderText="Sort Index" SortExpression="SortIndex" ItemStyle-Width="80px">
                                            <ItemTemplate>
                                                <div class="divHidden" style="width: 80px" title='<%# Eval("SortIndex")%>'>
                                                    <%#  Eval("SortIndex")%>
                                                </div>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox runat="server" ID="txtSortIndex" MaxLength="10" Text='<%#Eval("SortIndex") %>' Width="60px"></asp:TextBox>
                                                 <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="txtSortIndex" FilterMode="ValidChars" FilterType="Numbers"></asp:FilteredTextBoxExtender>
                                            </EditItemTemplate>
                                        </vs:TemplateField>
                                            <vs:TemplateField HeaderText="Colspan"  ItemStyle-Width="80px">
                                            <ItemTemplate>
                                                <div class="divHidden" style="width: 80px" title='<%# Eval("Colspan")%>'>
                                                    <%#  Eval("Colspan")%>
                                                </div>
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:TextBox runat="server" ID="txtColspan" MaxLength="10"  Text='<%#Eval("Colspan") %>' Width="60px"></asp:TextBox>
                                                <asp:FilteredTextBoxExtender runat="server" TargetControlID="txtColspan" FilterMode="ValidChars" FilterType="Numbers"></asp:FilteredTextBoxExtender>
                                            </EditItemTemplate>
                                        </vs:TemplateField>
                                        <vs:TemplateField HeaderText="Creation Date" ItemStyle-Width="90px" SortExpression="CreateDate">
                                            <ItemTemplate>
                                                <div title='<%#((DateTime)Eval("CreateDate")).ToString(ApplicationConfiguration.DateFormat)%>'>
                                                    <%#  ((DateTime)Eval("CreateDate")).ToString(ApplicationConfiguration.DateFormat)%>
                                                </div>
                                            </ItemTemplate>
                                        </vs:TemplateField>
                                          <asp:CommandField HeaderText="Edit" ShowEditButton="True" ShowHeader="True"
                                        ItemStyle-Width="100px" />
                                        <vs:TemplateField HeaderText="Delete" ItemStyle-Width="40px">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" SkinID="Delete" ImageAlign="AbsMiddle"
                                                    CausesValidation="false" CommandName="DeleteProperty" CommandArgument='<%# Eval("PropertyID") %>' />
                                            </ItemTemplate>
                                        </vs:TemplateField>
                                    </Columns>
                                </vs:GridView>
                                <uc1:GridPager ID="PageQueryAdapter1" runat="server" OnPerformGetCondition="PageQueryAdapter1_PerformGetCondition"
                                    OnPerformGetRecordCount="PageQueryAdapter1_PerformGetRecordCount" OnPerformGetPageData="PageQueryAdapter1_PerformGetPageData"
                                    TargetControlID="gridPropertyList" PageSize="20" />
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </fieldset>
            </td>
        </tr>
    </table>
</asp:Content>
